package com.my.study;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * @author: yidujun
 * @create: 2021/04/12 20:36
 */
public class NettyByteBuf01 {

    public static void main(String[] args) {

        ByteBuf buffer = Unpooled.buffer(10);

        for (int i = 0; i < 10; i++) {
            buffer.writeByte(i);
        }

        int capacity = buffer.capacity();
        System.out.println("capacity = " + capacity);

        for (int i = 0; i < capacity; i++) {
            System.out.println(buffer.readByte());
        }

        System.out.println("执行完毕~~");
    }

}
